/**
 * Copyright: xiao-an.com
 * Author: robbinzhao@qq.com
 */
import Vue from 'vue'
import VueRouter from 'vue-router'
import Vuex from 'vuex'
import VueCookie from 'vue-cookie'

import App from './App'
import router from './router'
import store from './store/stores'

import * as filters from './util/filter'

import BaiduMap from './plugins/baidu-map'
import { ToastPlugin } from './plugins/weui'

import './style.scss'

Vue.use(VueCookie)
Vue.use(VueRouter)
Vue.use(Vuex)
Vue.use(BaiduMap, { ak: window.BAIDU_MAP_AK })
Vue.use(ToastPlugin)

Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

/* eslint-disable no-new */
window.appRef = new Vue({
  el: '#app',
  template: '<App/>',
  router,
  store,
  components: { App }
})

let scale = document.body.clientWidth / 375
// scale = 1
document.querySelector('meta[name="viewport"]')
  .content = 'width=320, initial-scale=' + scale + ', maximum-scale=' + scale + ', minimum-scale=' + scale + ', user-scalable=no'
